package com.dxysun.design.composite.safe;

public class Main
{
	public static void main(String[] args)
	{
		Composite composite = new Composite("树枝节点", 2);

		Leaf leaf1 = new Leaf("叶子节点1");
		Leaf leaf2 = new Leaf("叶子节点2");
		composite.addChild(leaf1);
		composite.addChild(leaf2);

		Composite topComposite = new Composite("顶层节点", 1);
		Leaf leaf3 = new Leaf("叶子节点3");

		topComposite.addChild(composite);
		topComposite.addChild(leaf3);

		topComposite.operation();
	}
}
